﻿/*省份切换*/
    //省份
    function Province(str)
    {
        ProvinceSendAjax("Province",str);
    }
    //省份从usershoppinginfo.aspx打开
    function Province2(str)
    {
        ProvinceSendAjax2("Province",str);
    }

    function ProvinceSendAjax(op,str)
    {
        var param = "Option="+ op +"&ProvinceId="+ str;
        var options=
        {
            method:'post',
            parameters:param,
            onComplete:
            function(transport)
            {
                var retv=transport.responseText;
                document.getElementById("Cityli").innerHTML=retv;
            }     
        }
        new  Ajax.Request('makeorders.aspx',options);
    }
    
    function ProvinceSendAjax2(op,str)
    {
        var param = "Option="+ op +"&ProvinceId="+ str;
        var options=
        {
            method:'post',
            parameters:param,
            onComplete:
            function(transport)
            {
                var retv=transport.responseText;
                document.getElementById("Cityli").innerHTML=retv;
            }     
        }
        new  Ajax.Request('usershoppinginfo.aspx',options);
    }

    //城区
    function Citys(str)
    {
        CitysSendAjax("Citys",str);
    }
    
    //城区
    function Citys2(str)
    {
        CitysSendAjax2("Citys",str);
    }

    function CitysSendAjax(op,str)
    {
        var param = "Option="+ op +"&CitysId="+ str;
        var options=
        {
            method:'post',
            parameters:param,
            onComplete:
            function(transport)
            {
                var retv=transport.responseText;
                document.getElementById("City2li").innerHTML=retv;
            }     
        }
        new  Ajax.Request('makeorders.aspx',options);
    }
    
    function CitysSendAjax2(op,str)
    {
        var param = "Option="+ op +"&CitysId="+ str;
        var options=
        {
            method:'post',
            parameters:param,
            onComplete:
            function(transport)
            {
                var retv=transport.responseText;
                document.getElementById("City2li").innerHTML=retv;
            }     
        }
        new  Ajax.Request('usershoppinginfo.aspx',options);
    }

/*** 开始  修改人：YM 修改时间：2010-04-21 表单验证***/
function checkOrders()
{
    //收货人信息
    if(document.getElementById("isFillConsignedata").value!="1")
    {
       alert("温馨提示：您必须完整收货人信息！");
       return false;
    }
    //支付方式paymentMethod
	var paymentMethod = document.getElementsByName("paymentMethod");
	var isPaymentMethodChecked=false;
	if(paymentMethod)
	{
	    for (var j = 0; j < paymentMethod.length; j++)
		{
			if (paymentMethod[j].checked)
			{
			    isPaymentMethodChecked=true;
			}
		}
	}
	if(!isPaymentMethodChecked)
	{
		alert("温馨提示：您必须选定一个支付方式！");
		return false;
	}
	
	//配送方式DeliveryModeTable
	var deliveryModeTable = document.getElementsByName("DeliveryMode");
	var isDeliveryMethodChecked=false;
	if(deliveryModeTable)
	{
	    for (var j = 0; j < deliveryModeTable.length; j++)
		{
			if (deliveryModeTable[j].checked)
			{
			    isDeliveryMethodChecked=true;
			}
		}
	}
	if(!isDeliveryMethodChecked)
	{
		alert("温馨提示：您必须选定一个配送方式！");
		return false;
	}
}
function DeliveryCost(str)
{
   if(document.getElementById("productTotalPrice"))
   {
       var productPrice=document.getElementById("productTotalPrice").value;
       var feeTotalPrice=document.getElementById("FeeTotalPrice").value;
       var info="商品总价: ￥"+productPrice+"元";
       var totalPrice= parseFloat(productPrice);
       if(feeTotalPrice!="0.00"&&feeTotalPrice!="")
       {
           totalPrice=totalPrice+parseFloat(feeTotalPrice);
           info=info+" + "+"手续费: ￥"+feeTotalPrice+"元";
       }
       if(str!="0.00"&&str!="")
       {
           totalPrice=totalPrice+parseFloat(str);
           document.getElementById("freightTotalPrice").value=str;
           info=info+" + "+"配送费用: ￥"+str+"元";
       }
       
       document.getElementById("TotalCostMoney").innerHTML=totalPrice;
       document.getElementById("TotalPriceInfo").innerHTML=info;
   }
}

function PaymentCost(Cost)
{
   if(document.getElementById("productTotalPrice"))
   {
       var freightTotalPrice=document.getElementById("freightTotalPrice").value;
       var productPrice=document.getElementById("productTotalPrice").value;
       var info="商品总价: ￥"+productPrice+"元";
       var totalPrice= parseFloat(productPrice);
       if(freightTotalPrice!="0.00"&&freightTotalPrice!="")
       {
           totalPrice= totalPrice+parseFloat(freightTotalPrice);
           info=info+" + "+"配送费用: ￥"+freightTotalPrice+"元";
       }
       if(Cost!="0.00"&&Cost!="")
       {
           totalPrice=totalPrice+parseFloat(Cost);
           document.getElementById("FeeTotalPrice").value=Cost;
           info=info+" + "+"手续费: ￥"+Cost+"元";
       }
       
       document.getElementById("TotalCostMoney").innerHTML=totalPrice;
       document.getElementById("TotalPriceInfo").innerHTML=info;
   }
}
/*** 结束  修改人：YM 修改时间：2010-04-21 表单验证***/